package org.example.myleet.p1700;

public class Solution {
    public int countStudents(int[] students, int[] sandwiches) {
        int[] studentCount = new int[2];
        for (int student : students) {
            ++studentCount[student];
        }
        for (int i = 0; i < sandwiches.length; ++i) {
            if (studentCount[sandwiches[i]] == 0) {
                return sandwiches.length - i;
            }
            --studentCount[sandwiches[i]];
        }
        return 0;
    }
}
